<template>
  <div class="person">
    <h1>{{number}}</h1>
    <button @click="number++">更新</button>
  </div>

</template>
<script lang="ts" setup name="person">
  import { ref, reactive } from 'vue'
  import { onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount, onUnmounted } from 'vue';

  // 数据
  let number = ref(0);
  let personList = reactive([{ id: 'adsad3dsa211sdadas', name: "张三", age: 23 }, { id: 'adsad3dsa211sdadas', name: "魏国利", age: 35 }, { id: 'tgfgsad3dsa211sdadas', name: "马六", age: 28 }]);
  console.log("创建了!");



  // 方法
  onBeforeMount(() => {
    console.log("挂在前!");
  })

  onMounted(() => {
    console.log("挂在完毕！");
  })
  onBeforeUpdate(() => {
    console.log("更新前！");
  })
  onUpdated(() => {
    console.log("更新完毕！");
  })
  onBeforeUnmount(() => {
    console.log("卸载前！");
  })
  onUnmounted(() => {
    console.log("卸载完毕！");
  })
</script>

<style scoped>
  .person {
    background-color: aquamarine;
  }

  h1 {
    color: red;
    text-align: center;
    font-size: 80px;
    line-height: 200px;
    /* border: 1px solid blue; */
    margin: auto auto;
  }

  button {
    margin-top: 10px;
    width: 100%;
    height: 60px;
    border: unset;
    font-size: 20px;
    color: rgba(255, 1, 221, 0.533);
    background-color: rgba(248, 172, 8, 0.533);
  }
</style>